package org.study.service.config;

import org.springframework.stereotype.Service;
import org.study.entity.ClusterMachineEntity;
import org.study.service.IClusterMachineService;

import java.util.ArrayList;
import java.util.List;

@Service("clusterMachineServiceConfig")
public class ClusterMachineServiceConfig implements IClusterMachineService {

    @Override
    public List<ClusterMachineEntity> selectByList(ClusterMachineEntity entity) {
        List<ClusterMachineEntity> list = new ArrayList<>();
        list.add(builder(1,"hadoop1","192.168.56.21"));
        list.add(builder(2,"hadoop2","192.168.56.22"));
        list.add(builder(3,"hadoop3","192.168.56.23"));
        list.add(builder(4,"hadoop4","192.168.56.24"));
        list.add(builder(5,"hadoop5","192.168.56.25"));
        return list;
    }
    private ClusterMachineEntity builder(Integer machineId,String host, String ip){
        ClusterMachineEntity entity = new ClusterMachineEntity();
        entity.setClusterId(1);
        entity.setMachineId(machineId);
        entity.setHost(host);
        entity.setFramework("x86");
        entity.setIp(ip);
        entity.setOsInfo("centos 7");
        return entity;
    }
}
